<template>
<div>
  <!-- 视频标题 -->
  <div>
  视频标题 <input v-model="title" placeholder="请输入标题名称"></input>
  </div>
  <br>
  <!-- 下拉老师-->
  <div>
    关联老师 <select v-model="teacher">
    <option value="">请选择</option>
    <option value="0">老王</option>
    <option value="1">张梦龙</option>
    <option value="2">武晓慧</option>
    </select>
  </div>
  <br>
  <!-- 选择分类 -->
  <div>
    选择类型分类<select v-model="cate">
    <option value="">请选择</option>
    <option value="0">线下</option>
    <option value="1">线上</option>
    <option value="2">其他</option>
    </select>
  </div>
  <br>
  <!-- 收费模式 -->
  <div>
    选择收费模式 <input type="radio" v-model="moneyMode" value="0"> 付费模式
   <span v-show="moneyMode=='0' ?true:false" class="a">请输入金额 <input type="text" v-model="moneyCount"></span>
    <input type="radio" v-model="moneyMode" value="1"> 免费模式
  </div>
  <br>
  <!-- 视频简介 -->
  <div>
  视频简介 <input v-model="des" placeholder="请输入分享描述"></input>
  <br>
  <br>
  </div>
  <!-- 视频详情 -->
  <div>
  视频简介 
  <textarea v-model="videoDetail" cols="30" rows="10"></textarea>
  </div>
  <br>
  <!-- 开售时间 -->
 <div>
  开售时间<input type="radio" v-model="timeModel" value="0">立即开售
  <input type="radio" v-model="timeModel" value="1">定时开售
  <span v-show="timeModel=='1' ?true:false" class="a">请输入时间 <input type="text" v-model="timeCount"></span>
  <input type="radio" v-model="timeModel" value="3">暂不开售
 </div>
 <button @click="submit">保存</button>
</div>
</template>

<script>
export default {
  data() {
    return {
      title: '',
      teacher: '',
      cate: '',
      moneyMode: '',
      moneyCount: '',
      des: '',
      videoDetail: '',
      timeModel: '',
      timeCount:'',
    } 
  },
  methods: {
    submit() {
      const a = {
        title: this.title,
        teacher: this.teacher,
        cate: this.cate,
        moneyMode: this.moneyMode,
        moneyCount: this.moneyCount,
        des: this.des,
        videoDetail: this.videoDetail,
        timeModel: this.timeModel,
        timeCount:this.timeCount
      }
      if (this.moneyMode=='1') {
        delete a.moneyCount
        // 判断付费模式是免费的时候清空付费数据
      }
      if (this.timeModel=='0') {
        delete a.timeCount
        // 判断开售时间是立即开售的时候清空定时开售时间
      }
      if (this.timeModel=='3') {
        delete a.timeCount
        //判断开售时间是暂不开售的时候清空定时开售时间
      }
      console.log(a);
    }
  }
 }
</script>